package com.xugongzhang.spring.config;

import com.xugongzhang.spring.beans.PersonFactoryBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;

/**
 * @author X
 * @date 2022/11/30 23:44
 */
@Configuration
@EnableConfigurationProperties(Car.class)
public class MyConfig {
    
    @Scope("singleton")
    @Lazy
    @Bean
    public Car car() {
        System.out.println("容器创建bean。。。");
        return new Car();
    }
    
    @Bean
    public PersonFactoryBean personFactoryBean() {
        return new PersonFactoryBean();
    }
}
